#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int judge(int i)
{
    int n = i;
    while (n)
    {
        int z = n % 10;
        if (z == 0 || i % z != 0)
        {
            return 0;
        }
        n /= 10;
    }
    return 1;
}

int* selfDividingNumbers(int left, int right, int* returnSize) {
    int* ans = (int*)malloc(sizeof(int) * (right - left + 1));
    int z = 0;
    for (int i = left; i <= right; i++)
    {
        if (judge(i))
        {
            ans[z++] = i;
        }
    }
    *returnSize = z;
    return ans;
}

int main()
{
    int i = 1;
    selfDividingNumbers(1, 22, &i);
	return 0;
}